<!--# layout("/common/layout.html",{"jsBase":"/js/crm/crmRepresentiveConfig/"}){ -->

<form class="layui-form layui-form-pane" id="addForm"  lay-filter="editform">
    <input type="hidden" name="configId" id="configId">

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">自动接入</label>
				<div class="layui-input-inline">
                                <input type="radio" name="autoAccess" value="1" title="是">
                                <input type="radio" name="autoAccess" value="0" title="否">
				</div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">坐席服务人数</label>
				<div class="layui-input-inline">
                                <input type="text" name="maxSession" id="maxSession" autocomplete="off" maxlength="50" class="layui-input" >
				</div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">客户空闲时长</label>
				<div class="layui-input-inline">
                                <input type="text" name="idleCustomer" id="idleCustomer" autocomplete="off" maxlength="50" class="layui-input" lay-verify="number">
				</div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">坐席空闲时长</label>
				<div class="layui-input-inline">
                                <input type="text" name="idleRepresentive" id="idleRepresentive" autocomplete="off" maxlength="50" class="layui-input" lay-verify="number">
				</div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">工作日定义</label>
				<div class="layui-input-inline" style="width:340px">
                    <input type="radio" name="workingDay" value="1" title="周一至周五">
                    <input type="radio" name="workingDay" value="2" title="全周">
                    <input type="radio" name="workingDay" value="3" title="休假">
				</div>
            </div>

        </div><!--form item-->
    </div><!--row-->

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">开始时间 </label>
                <div class="layui-input-inline">
                    <input type="text" name="startTime" id="startTime" autocomplete="off" maxlength="50" class="layui-input" lay-verify="number">
                </div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">截止时间</label>
				<div class="layui-input-inline">
                                <input type="text" name="endTime" id="endTime" autocomplete="off" maxlength="50" class="layui-input" lay-verify="number">
				</div>
            </div>

        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">繁忙提示</label>
                <div class="layui-input-block" style="width:517px">
                    <textarea name="busyMsg"  id="busyMsg" placeholder="请输入" class="layui-textarea"></textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">未上班时</label>
                <div class="layui-input-block" style="width:517px">
                    <textarea name="closeTimeMsg"  id="closeTimeMsg" placeholder="请输入" class="layui-textarea"></textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label">自动回复</label>
                <div class="layui-input-block" style="width:517px">
                    <textarea name="autoReply"  id="autoReply" placeholder="请输入" class="layui-textarea"></textarea>
                </div>
            </div>
        </div>
    </div>
    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
layui.extend({
    loading: '../../../plugins/layui_extends/loading/loading',
}).define([ 'form', 'laydate', 'table','loading','crmRepresentiveConfigApi'], function(exports) {
    var form = layui.form;
    var crmRepresentiveConfigApi = layui.crmRepresentiveConfigApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(crmRepresentiveConfigJson))){  -->
    isNew = false;
    <!--# } -->
    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#addButton").click(function(){
                // $("#addButton").hide();
                // $("#addButton-loading").show();
                // $("#addButton-loading").loading();
                form.on('submit(form)', function(){
                    crmRepresentiveConfigApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });

            $("#addButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();
    <!--# if(!(isEmpty(crmRepresentiveConfigJson))){  -->
    var formJson = ${crmRepresentiveConfigJson};
    form.val("editform",formJson);
    <!--# } -->
});
</script>
